package com.loe.test

import android.app.Application
import android.util.Log
import android.widget.Toast
import com.loe.logger.LoeLogger

class App : Application()
{
    override fun onCreate()
    {
        super.onCreate()

        LoeLogger.init(this, false)

        LoeLogger.addServeEnvironment("测试环境", "http://ldbj.test.api.alongding.com/api/AppManage")
        LoeLogger.addServeEnvironment("正式环境", "https://ldbj.api.alongding.com/api/AppManage")
        LoeLogger.setOnServeEnvironmentListener()
        {
            Log.d("服务端环境->", it.type + " - " + it.baseUrl)
        }

        LoeLogger.setOnWebEnvironmentListener()
        {
            Log.d("h5前端环境->", it.type + " - " + it.baseUrl)
        }

        LoeLogger.setOnOpenPage()
        { activity, url ->
            // TODO 打开链接
            Toast.makeText(this, "打开链接：$url", Toast.LENGTH_SHORT).show()
        }

        NetCacheDb.init(this)
    }
}